<html>
<head><meta charset="utf-8"><title>panic on socket4 syscall on target android · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/panic.20on.20socket4.20syscall.20on.20target.20android.html">panic on socket4 syscall on target android</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="227572197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/panic%20on%20socket4%20syscall%20on%20target%20android/near/227572197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> apiraino <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/panic.20on.20socket4.20syscall.20on.20target.20android.html#227572197">(Feb 24 2021 at 09:43)</a>:</h4>
<p>Is issue <a href="https://github.com/rust-lang/rust/issues/82400">#82400</a> of any interest for this group?</p>



<a name="227577530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/panic%20on%20socket4%20syscall%20on%20target%20android/near/227577530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/panic.20on.20socket4.20syscall.20on.20target.20android.html#227577530">(Feb 24 2021 at 10:28)</a>:</h4>
<p>Yes, though it sounds like the fix belongs in the <code>libc</code> crate rather than in std.</p>



<a name="227577722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/panic%20on%20socket4%20syscall%20on%20target%20android/near/227577722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/panic.20on.20socket4.20syscall.20on.20target.20android.html#227577722">(Feb 24 2021 at 10:30)</a>:</h4>
<p>Shouldn't be too hard; just requires changing the syscall invocation to call <code>syscall(SYS_socketcall</code>, and passing the arguments as an array of <code>c_ulong</code> values.</p>



<a name="227578015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/panic%20on%20socket4%20syscall%20on%20target%20android/near/227578015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/panic.20on.20socket4.20syscall.20on.20target.20android.html#227578015">(Feb 24 2021 at 10:33)</a>:</h4>
<p>Something like this:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">args</span>: <span class="p">[</span><span class="n">c_ulong</span><span class="p">;</span><span class="w"> </span><span class="mi">4</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">fd</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">c_ulong</span><span class="p">,</span><span class="w"> </span><span class="n">addr</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">c_ulong</span><span class="p">,</span><span class="w"> </span><span class="n">len</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">c_ulong</span><span class="p">,</span><span class="w"> </span><span class="n">flg</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">c_ulong</span><span class="p">];</span><span class="w"></span>
<span class="w">        </span><span class="n">syscall</span><span class="p">(</span><span class="n">SYS_socketcall</span><span class="p">,</span><span class="w"> </span><span class="n">SYS_accept4</span><span class="p">,</span><span class="w"> </span><span class="n">args</span><span class="p">.</span><span class="n">as_ptr</span><span class="p">())</span><span class="w"> </span><span class="k">as</span><span class="w"> </span>::<span class="n">c_int</span><span class="w"></span>
</code></pre></div>



<a name="227581949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/panic%20on%20socket4%20syscall%20on%20target%20android/near/227581949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> apiraino <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/panic.20on.20socket4.20syscall.20on.20target.20android.html#227581949">(Feb 24 2021 at 11:06)</a>:</h4>
<p>thank you Josh! Looks like a PR is already on the way</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>